package ss9999999999;

public class three {
    public static void main(String[] args) {
        /*int num=0;
        for (int i=1;i<=500;i++) {
            if(i==4||i%10==4||i/100==4||i/10%10==4){
                num++;
                continue;
            }
        }
        System.out.println(500-num);
        //324*/

        int num=0;
        for (int i=1;i<500;i++){
            String a=String.valueOf(i);
            if (a.indexOf("4")>=0){
                num+=1;
            }
        }
        System.out.println(500-num);
    }
}
